package a.h;

import javax.swing.*;
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;
import java.util.Collection;

class lb
{
  static final od a = new od(40, d());
  static final od b = new od(8);
  static final int c = 0;
  static final int d = 1;
  static final int e = 2;
  private int f = 0;
  private Color g;
  private final ic h;
  private final Collection i;
  private JPopupMenu j;
  private String k;
  private String l;
  
  lb(ic paramic, JComponent paramJComponent, ob paramob)
  {
    this.g = ((Color)paramic.o());
    this.h = paramic;
    this.i = new ArrayList();
    if (m == 0)
    {
      if (paramob == null)
      {
        this.k = dc.a().b("COLOR_OPTION_ITEM.MORE_COLORS");
        this.l = dc.a().b("COLOR_OPTION_ITEM.NO_COLOR");
        if (m != 0) {
          return;
        }
        if (!ec.s) {}
      }
      else
      {
        this.k = paramob.b("COLOR_OPTION_ITEM.MORE_COLORS");
        this.l = paramob.b("COLOR_OPTION_ITEM.NO_COLOR");
      }
    }
    else
    {
      if (m == 0) {
        if ("COLOR_OPTION_ITEM.MORE_COLORS".equals(this.k)) {
          this.k = dc.a().b("COLOR_OPTION_ITEM.MORE_COLORS");
        }
      }
      if ("COLOR_OPTION_ITEM.NO_COLOR".equals(this.l)) {
        this.l = dc.a().b("COLOR_OPTION_ITEM.NO_COLOR");
      }
    }
    a(paramJComponent, paramob);
  }
  
  private void a(JComponent paramJComponent, ob paramob)
  {
    int m = ec.t;
    AbstractAction local3 = new AbstractAction(this.k)
    {
      private final ob val$gf;
      private final JComponent val$parent;
      
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        int j = ec.t;
        boolean bool2 = ec.s;
        if (j == 0) {
          if (this.val$gf != null)
          {
            localObject = new String[] { "ColorChooser.okText", "ColorChooser.cancelText", "ColorChooser.previewText", "ColorChooser.resetText", "ColorChooser.rgbBlueMnemonic", "ColorChooser.rgbBlueText", "ColorChooser.rgbGreenMnemonic", "ColorChooser.rgbGreenText", "ColorChooser.rgbNameText", "ColorChooser.rgbRedMnemonic", "ColorChooser.rgbRedText", "ColorChooser.sampleText", "ColorChooser.swatchesNameText", "ColorChooser.swatchesRecentText" };
            boolean bool1 = false;
            if (j == 0) {
              if ((this.val$gf instanceof c))
              {
                bool1 = ((c)this.val$gf).a();
                ((c)this.val$gf).a(true);
              }
            }
            int i = 0;
            do
            {
              do
              {
                if (i >= localObject.length) {
                  break;
                }
                String str = localObject[i];
                if (j != 0) {
                  break label241;
                }
                UIManager.put(str, this.val$gf.b(str));
                i++;
                if (bool2) {
                  break label227;
                }
              } while (!bool2);
              if (j != 0) {
                break label228;
              }
            } while (j != 0);
            if ((this.val$gf instanceof c)) {
              ((c)this.val$gf).a(bool1);
            }
          }
        }
        label227:
        label228:
        label241:
        Object localObject = nb.a(lb.this.h, this.val$gf);
        Color localColor = wd.a(this.val$parent, (String)localObject, lb.this.g, ic.b(lb.this.h));
        if (j == 0)
        {
          if (localColor != null)
          {
            if (j != 0) {
              break label299;
            }
            lb.this.a(localColor);
          }
        }
        else if (!bool2) {
          return;
        }
        label299:
        lb.this.a();
      }
    };
    ActionListener local0 = new ActionListener()
    {
      public void actionPerformed(ActionEvent paramAnonymousActionEvent)
      {
        lb.this.a(((yd)paramAnonymousActionEvent.getSource()).e().getSelectedItem());
      }
    };
    this.j = new JPopupMenu();
    if (m == 0) {
      if (this.h.b())
      {
        this.j.add(new AbstractAction(this.l)
        {
          public void actionPerformed(ActionEvent paramAnonymousActionEvent)
          {
            lb.this.a(null);
          }
        });
        this.j.addSeparator();
      }
    }
    yd localyd;
    if (m == 0) {
      if (this.h.q())
      {
        localyd = new yd(a, 8, ic.b(this.h), ic.a(this.h));
        localyd.a(local0);
        this.j.add(localyd);
        this.j.addSeparator();
      }
    }
    if (m == 0)
    {
      if (this.h.r())
      {
        localyd = new yd(b, 8, ic.b(this.h), ic.a(this.h));
        localyd.a(local0);
        this.j.add(localyd);
        this.j.addSeparator();
      }
      if (m != 0) {}
    }
    else if (this.h.s())
    {
      this.j.add(local3);
    }
    this.j.addPopupMenuListener(new PopupMenuListener()
    {
      public void popupMenuCanceled(PopupMenuEvent paramAnonymousPopupMenuEvent)
      {
        lb.this.a();
      }
      
      public void popupMenuWillBecomeInvisible(PopupMenuEvent paramAnonymousPopupMenuEvent)
      {
        if ((ec.t != 0) || (lb.this.f == 1)) {
          lb.this.a();
        }
      }
      
      public void popupMenuWillBecomeVisible(PopupMenuEvent paramAnonymousPopupMenuEvent)
      {
        lb.this.f = 0;
      }
    });
  }
  
  public void a()
  {
    this.f = 1;
    b();
  }
  
  public void a(Object paramObject)
  {
    b((Color)paramObject);
    this.f = 2;
    b(paramObject);
  }
  
  private void b(Object paramObject)
  {
    int n = ec.t;
    boolean bool = ec.s;
    if ((n != 0) || (!this.i.isEmpty()))
    {
      c_[] arrayOfc_ = new c_[this.i.size()];
      this.i.toArray(arrayOfc_);
      int m = 0;
      do
      {
        if (m >= arrayOfc_.length) {
          break;
        }
        arrayOfc_[m].a(this.j, paramObject);
        m++;
      } while (!bool);
    }
  }
  
  private void b()
  {
    int n = ec.t;
    boolean bool = ec.s;
    if ((n != 0) || (!this.i.isEmpty()))
    {
      c_[] arrayOfc_ = new c_[this.i.size()];
      this.i.toArray(arrayOfc_);
      int m = 0;
      do
      {
        if (m >= arrayOfc_.length) {
          break;
        }
        arrayOfc_[m].a();
        m++;
      } while (!bool);
    }
  }
  
  public void a(c_ paramc_)
  {
    this.i.add(paramc_);
  }
  
  public JPopupMenu c()
  {
    return this.j;
  }
  
  public void a(Color paramColor)
  {
    this.g = paramColor;
  }
  
  static void b(Color paramColor)
  {
    if (paramColor != null) {
      b.a(paramColor);
    }
  }
  
  static Collection d()
  {
    ArrayList localArrayList = new ArrayList();
    localArrayList.add(Color.black);
    localArrayList.add(new Color(153, 51, 0));
    localArrayList.add(new Color(51, 51, 0));
    localArrayList.add(new Color(0, 51, 0));
    localArrayList.add(new Color(0, 51, 102));
    localArrayList.add(new Color(0, 0, 128));
    localArrayList.add(new Color(51, 51, 153));
    localArrayList.add(new Color(51, 51, 51));
    localArrayList.add(new Color(128, 0, 0));
    localArrayList.add(new Color(255, 102, 0));
    localArrayList.add(new Color(128, 128, 0));
    localArrayList.add(new Color(0, 128, 0));
    localArrayList.add(new Color(0, 128, 128));
    localArrayList.add(Color.blue);
    localArrayList.add(new Color(102, 102, 153));
    localArrayList.add(new Color(128, 128, 128));
    localArrayList.add(Color.red);
    localArrayList.add(new Color(255, 153, 0));
    localArrayList.add(new Color(153, 204, 0));
    localArrayList.add(new Color(51, 153, 102));
    localArrayList.add(new Color(51, 204, 204));
    localArrayList.add(new Color(51, 102, 255));
    localArrayList.add(new Color(128, 0, 128));
    localArrayList.add(new Color(153, 153, 153));
    localArrayList.add(new Color(255, 0, 255));
    localArrayList.add(new Color(255, 204, 0));
    localArrayList.add(new Color(255, 255, 0));
    localArrayList.add(Color.green);
    localArrayList.add(new Color(0, 255, 255));
    localArrayList.add(new Color(0, 204, 255));
    localArrayList.add(new Color(153, 51, 102));
    localArrayList.add(new Color(192, 192, 192));
    localArrayList.add(new Color(255, 153, 204));
    localArrayList.add(new Color(255, 204, 153));
    localArrayList.add(new Color(255, 255, 153));
    localArrayList.add(new Color(204, 255, 204));
    localArrayList.add(new Color(204, 255, 255));
    localArrayList.add(new Color(153, 204, 255));
    localArrayList.add(new Color(204, 153, 255));
    localArrayList.add(Color.white);
    return localArrayList;
  }
  
  static abstract interface c_
  {
    public abstract void a(JPopupMenu paramJPopupMenu, Object paramObject);
    
    public abstract void a();
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.h.lb

 * JD-Core Version:    0.7.0.1

 */